/* 封装频道接口 */

import axios from '@/utils/request'

/*
获取用户的频道数据
 */
export function getChannels() {
  return axios({
    url: '/v1_0/user/channels'
  })
}

/**
 * 获取所有的频道数据
 *
 * @export
 * @return {*}
 */
export function getAllChannels() {
  return axios({
    url: '/v1_0/channels'
  })
}

/**
 * 设置用户的频道（部分覆盖）
 *
 * @export
 * @param {*} channels 频道数据
 * @return {*}
 */
export function setUserChannel(channels) {
  return axios({
    url: '/v1_0/user/channels',
    method: 'PATCH',
    data: {
      channels
    }
  })
}

/**
 * 删除用户频道
 *
 * @export
 * @param {*} target 用户频道id
 * @return {*}
 */
export function delUserChannel(target) {
  return axios({
    url: `/v1_0/user/channels/${target}`,
    method: 'DELETE'
  })
}
